<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.thymeleaf.org"
      layout:decorator="layout/m_master">

<div layout:fragment="content">
    <input type="hidden" value="work" id="filedir">
    <div class="page-group">
        <div class="page page_manage_auth_public page_manage_auth_identity">

            <div class="page-content">
                <div th:replace="layout/m_layout::title('工作认证')"></div>
                <div class="head">
                    <img class="icon" src="/m/img/page_auth_work_head.svg"/>
                    <div class="head-title">提交工作资料</div>
                </div>

                <div class="content headstatus" th:if="${auth.workCheck eq 3}">
                    <div style="text-align: center; padding:4rem 2rem">
                        <div style="font-size:1.5rem;color: #F60">
                            等待审核中
                        </div>
                        <div style="font-size: .7rem; color: #999;">你提交的资料等待审核中,如需修改请联系客服～</div>
                    </div>
                </div>

                <div class="formcontent" th:if="${auth.workCheck ne 3}">
                    <form bottlecms-form-ajax="" id="thisform" method="post" onsubmit="return check()">
                        <div class="content">
                            <div class="bcui-form ">
                                <div class="upfilebox">
                                    <div class="upbtn filebox">
                                        <img class="imgshow previews education_pic-previews" th:src="${auth.workPic}"/>

                                        <input type="hidden" name="workPic" id="workPic" th:value="${auth.workPic}"/>
                                        <input type="file" accept="image/*" data-previews=".education_pic-previews"/>

                                        <i class="btnicon icon-bottlecms-20"></i>
                                    </div>
                                    <div class="tit">添加工作证书</div>
                                </div>
                            </div>
                        </div>

                        <div class="btnbox">
                            <button class="btn btn-success submit" type="submit">
                                确认提交
                            </button>
                        </div>

                    </form>

                </div>

                <div style="height: 3rem;"></div>

            </div>
        </div>
    </div>
    <div th:replace="layout/m_layout::systemJs"></div>
    <script type="text/javascript">

        $('input[type="file"]').change(function (event) {
            var _this = this;
            var option = $(this).data();
            bottlecms.uploadfile({
                elem: this,
                data: option,
                success: function (pic) {
                    $(_this).prev('input').val(pic)
                    if (option.function) eval(option.function + "('" + pic + "')");
                    if (option.previews) $(option.previews).attr('src', pic);
                }
            })
        });


        function check() {
            var workPic = $("#workPic").val();
            if (workPic.length == 0 || workPic.indexOf(".svg") > 0) {
                bottlecms.toast("请上传工作证书");
                return false;
            }
            $("#thisform").attr("action", "/m/ajax/center/auth/work");
            return true;
        }
    </script>


</div>
</html>
